package com.qpx.springbootdemo1.entity;


public enum Sex {

    MAN(0,"男"),
    WMAN(1,"女");

    private int code;
    private String name;

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    Sex(int code, String name) {
        this.code = code;
        this.name = name;
    }


    public static Sex getName(int code){
        for (Sex sex :Sex.values()){
            if (sex.getCode() == code){
                return sex;
            }
        }
        return  null;
    }
}
